{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">客服中心</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

                <form class="layui-form layui-form-pane" action="{:url('/admin/message')}" method="get">
                    <div class="layui-inline mleft">
                        <label class="layui-form-label" style="width: 60px;">状态</label>
                        <div class="layui-input-inline" style="width: 100px;">
                            <select name="status" lay-filter="status">
                                <option value="-1"{if condition="$status == -1"} selected{/if}>所有</option>
                                <option value="0" {if condition="$status == 0"} selected{/if}>未读</option>
                                <option value="1" {if condition="$status == 1"} selected{/if}>处理中</option>
                                <option value="2" {if condition="$status == 2"} selected{/if}>已解决</option>
                            </select>
                        </div>
                    </div>

{/*                    <div class="layui-inline mleft">*/}
{/*                        <label class="layui-form-label">选择游戏</label>*/}
{/*                        <div class="layui-input-inline" style="width: 130px;">*/}
{/*                            <select name="gid" lay-filter="gid" id="gid" lay-search>*/}
{/*                                <option value="">请选择游戏</option>*/}
{/*                                {foreach name=":get_game_list()" item="vo"&cc;*/}
{/*                                    <option value="{$vo.id&cc;"{if condition="input('gid') == $vo.id"&cc; selected{/if&cc;>{$vo['name']&cc;</option>*/}
{/*                                {/foreach&cc;*/}
{/*                            </select>*/}
{/*                        </div>*/}
{/*                    </div>*/}

                    <div class="layui-inline">
                        <button class="layui-btn">搜索</button>
                    </div>
                </form>
                <hr>

                <table class="layui-table">
                    <thead>
                    <tr>
                        <th >ID</th>
                        <th>用户名</th>
                     	<th>游戏</th>
                        <th>问题类型</th>
                        <th>区服</th>
                        <th>角色</th>
                     	<th>描述</th>
                     	<th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="list" item="vo"}
                    <tr>
                        {php}$content = json_decode($vo['content'],true){/php}
                        <td>{$vo.id}</td>
                        <td>{:get_player($vo['uid'],"account")}</td>
                        <td>{:get_game_filed($content['gid'],"name")}</td>
                        <td>{:getReportTypeName($content['reportType'])}</td>
                        <td>{notempty name="$content['server']"}{$content['server']}{/notempty}</td>
                        <td>{notempty name="$content['character']"}{$content['character']}{/notempty}</td>
                        <td>{$content['desc']}</td>
                        <td>
                            {switch name="$vo['status']" }
                            {case value="0"}<font color=red>未处理</font>{/case}
                            {case value="1"}处理中{/case}
                            {case value="2"}已解决{/case}
                            {default /}异常
                            {/switch}
                        </td>
                        <td>
                            {if condition="$vo['status'] == 2"}
                                <a href="{:url('/admin/message/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">已解决</a>
                            {elseif condition="($vo['status'] eq 0 )"}
                                <a href="{:url('/admin/message/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini">待回复</a>
                            {elseif condition="$vo['status'] eq 1 && count($vo['get_detail']) > 0"}
                                <a href="{:url('/admin/message/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini">待回复</a>
                            {else/}
                                <a href="{:url('/admin/message/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">消息记录</a>
                            {/if}
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                <!--分页-->
                {$list|raw}
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    function opneImg(img){
        layer.open({
            type: 1,
            title: false,
            closeBtn: 1,
            area: ['auto', 'auto'],
            skin: 'layui-layer-nobg',
            shadeClose: true,
            content: '<img src="' + img.src + '" style="width: 450px;height: 600px;">'
        });
    }
</script>
{/block}